#ifndef MYSQLCONNECTIONPOOL_H
#define MYSQLCONNECTIONPOOL_H

#include "core_global.h"
#include <mysql++.h>
#include <boost/noncopyable.hpp>

class MysqlConnectionPool :
        public mysqlpp::ConnectionPool,
        protected boost::noncopyable
{
public:
    MysqlConnectionPool(const std::string &db,
                        const std::string &host,
                        const std::string &user,
                        const std::string &password,
                        unsigned short port);

    ~MysqlConnectionPool();

protected:
    mysqlpp::Connection *create();

    void destroy(mysqlpp::Connection *c);

    unsigned int max_idle_time();

private:
    std::string     m_db;
    std::string     m_server;
    std::string     m_user;
    std::string     m_password;
    unsigned short  m_port;
};

#endif // MYSQLCONNECTIONPOOL_H
